package inputstream;


import org.junit.Test;

import java.io.*;

public class BufferdInputStream_ {
    @Test

    public void bufferdInputStream01() {
        //BufferedInputStream bufferedInputStream = null;
        BufferedInputStream bufferedInputStream = null;
        byte[] bytes=new byte[4];
        int len=0;
        try {
            bufferedInputStream= new BufferedInputStream(new FileInputStream("D:\\xuexi\\Hello.txt"));
          while ((len=bufferedInputStream.read(bytes))!=-1){
              System.out.print(new String(bytes,0,len));
          }

        } catch (IOException e) {
            e.printStackTrace();
        }finally {
            try {
                bufferedInputStream.close();
            } catch (IOException e) {
                e.printStackTrace();
            }
        }
    }
}
